package com.kaisa.activity.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.kaisa.activity.R;

import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

/**
 * Created by Administrator on 2015/12/17.
 * 出发地
 */
public class OriginActivity extends AppCompatActivity {
    @ViewInject(R.id.lv_origin)
    private ListView originLV;

    private String[] origins = {"全部","北京","三亚","西安","沈阳","香港","天津",
            "杭州","广州","武汉","成都","上海","哈尔滨","长沙","重庆","布雷达","厦门"};

    private ArrayAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_origin);
        x.view().inject(this);

        initView();
        initData();
    }

    private void initView() {
        adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1,origins);
        originLV.setAdapter(adapter);

        originLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Intent intent=new Intent();
                intent.putExtra("all", origins[i]);
                setResult(101, intent);
                finish();
            }
        });
    }

    private void initData() {

    }
}
